package org.xdq.base;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 数据状态枚举
 * @author Administrator
 *
 */
public enum DataStatusEnum {
	
	未确定("00","未确定"),
	已确定("22","已确定"),
	已启用("55","已启用"),
	已禁用("77","已禁用");
	
	private String code;
	private String name;
	
	private DataStatusEnum(String code,String name) {
		this.code=code;
		this.name=name;
	}

	public String getCode() {
		return code;
	}

	public String getName() {
		return name;
	}
	
	public static String getName(String code) {
		DataStatusEnum[] values = DataStatusEnum.values();
		for(DataStatusEnum value : values) {
			if(value.getCode().equals(code)) {
				return value.name;
			}
		}
		return null;
	}
	
	public static List<Map<String,String>> toList(){
		
		List<Map<String,String>> list = new ArrayList<Map<String,String>>();
		DataStatusEnum[] values = DataStatusEnum.values();
		for(DataStatusEnum value : values) {
			Map<String,String> map = new HashMap<String,String>();
			map.put("code", value.code);
			map.put("name", value.name);
			list.add(map);
		}
		return list;
		
	}

}
